package cn.wx.scholar.core.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import cn.wx.common.persistence.base.BaseEntity;
import cn.wx.scholar.core.entity.dto.TxtBookPd;
/**
 * <p>
 * 
 * </p>
 *
 * @author  
 * @since 2018-08-02
 */
@TableName("txt_book")
public class TxtBook extends BaseEntity {

	private String lang;

	private String asin;

	private String publisher;

	private String paperback;

	private String shippingWeight;

	private String language;

	private String productDimensions;

	private String averageCustomerReview;

	private String ISBN_10;

	private String ISBN_13;

	private String aeString;

	private String name;

	private String href;

	private String bi;

	private String pb;
	
	@JSONField(name="_ae")
	private String ae_;

	private String tag;

	private String pd;

	private String isbn;

	private String pn;

	private String fi;

	@TableField(exist = false)
	@JSONField(name="_pd")
	private TxtBookPd tpd;
	
	@TableField(exist = false)
	@JSONField(name="ae")
	private String[] aeArray;
	
	/**
	 * 对应的文件
	 */
	private Integer fileName;
	
	
	private String fiPic;
	
	/**
	 * 处理_pd对象
	 */
	public void supply(Integer fileName,String fiPic) {
		
		if(this.tpd != null) {
			this.publisher = this.tpd.getPublisher();
			this.paperback = this.tpd.getPaperback();
			this.shippingWeight = this.tpd.getShippingWeight();
			this.language = this.tpd.getLanguage();
			this.productDimensions = this.tpd.getProductDimensions();
			this.averageCustomerReview = this.tpd.getAverageCustomerReview();
			this.ISBN_10 = this.tpd.getISBN_10();
			this.ISBN_13 = this.tpd.getISBN_13();
		}
		
		this.fileName = fileName;
		this.fiPic = fiPic;
		
		
		
		if(this.aeArray != null && this.aeArray.length >0) {
			String a = "";
			for(int i=1;i<this.aeArray.length;i++) {
				if(i%2 != 0) {
					if(i==1) {
						a = this.aeArray[i-1];
					}else {
						a = a + "," + this.aeArray[i-1];
					}
					
				}
			}
			this.aeString = a;
		}
	}
	
	public String getLang() {
		return lang;
	}

	public void setLang(String lang) {
		this.lang = lang;
	}

	public String getAsin() {
		return asin;
	}

	public void setAsin(String asin) {
		this.asin = asin;
	}

	public String getPublisher() {
		return publisher;
	}

	public void setPublisher(String publisher) {
		this.publisher = publisher;
	}

	public String getPaperback() {
		return paperback;
	}

	public void setPaperback(String paperback) {
		this.paperback = paperback;
	}

	public String getShippingWeight() {
		return shippingWeight;
	}

	public void setShippingWeight(String shippingWeight) {
		this.shippingWeight = shippingWeight;
	}

	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getProductDimensions() {
		return productDimensions;
	}

	public void setProductDimensions(String productDimensions) {
		this.productDimensions = productDimensions;
	}

	public String getAverageCustomerReview() {
		return averageCustomerReview;
	}

	public void setAverageCustomerReview(String averageCustomerReview) {
		this.averageCustomerReview = averageCustomerReview;
	}

	public String getISBN_10() {
		return ISBN_10;
	}

	public void setISBN_10(String iSBN_10) {
		ISBN_10 = iSBN_10;
	}

	public String getISBN_13() {
		return ISBN_13;
	}

	public void setISBN_13(String iSBN_13) {
		ISBN_13 = iSBN_13;
	}

//	public String getAe() {
//		return ae;
//	}
//
//	public void setAe(String ae) {
//		this.ae = ae;
//	}
	
	public String getName() {
		return name;
	}

	public String getAeString() {
		return aeString;
	}

	public void setAeString(String aeString) {
		this.aeString = aeString;
	}

	public String getAe_() {
		return ae_;
	}

	public void setAe_(String ae_) {
		this.ae_ = ae_;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public String getBi() {
		return bi;
	}

	public void setBi(String bi) {
		this.bi = bi;
	}

	public String getPb() {
		return pb;
	}

	public void setPb(String pb) {
		this.pb = pb;
	}

//	public String get_ae() {
//		return _ae;
//	}
//
//	public void set_ae(String _ae) {
//		this._ae = _ae;
//	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public String getPd() {
		return pd;
	}

	public void setPd(String pd) {
		this.pd = pd;
	}

	public String getIsbn() {
		return isbn;
	}

	public void setIsbn(String isbn) {
		this.isbn = isbn;
	}

	public String getPn() {
		return pn;
	}

	public void setPn(String pn) {
		this.pn = pn;
	}

	public String getFi() {
		return fi;
	}

	public void setFi(String fi) {
		this.fi = fi;
	}
	
	public TxtBookPd getTpd() {
		return tpd;
	}

	public void setTpd(TxtBookPd tpd) {
		this.tpd = tpd;
	}
	
	public Integer getFileName() {
		return fileName;
	}

	public void setFileName(Integer fileName) {
		this.fileName = fileName;
	}

	public String getFiPic() {
		return fiPic;
	}

	public void setFiPic(String fiPic) {
		this.fiPic = fiPic;
	}


	public String[] getAeArray() {
		return aeArray;
	}


	public void setAeArray(String[] aeArray) {
		this.aeArray = aeArray;
	}
	
}
